<?php

namespace App\Http\Controllers\Mini;

use App\Http\Controllers\Controller;
use App\Models\StudentCourseModel;
use App\Models\StudentSignModel;
use Illuminate\Http\Request;

class StudentCourseController extends Controller
{
    public function list(Request $request) {
        $courses = StudentCourseModel::with('course')->where('student_id', $request->studentId)->get();
        return self::ok($courses);
    }

    public function detail(Request $request) {
        $studentCourseId = $request->studentCourseId;
        $course = StudentCourseModel::find($studentCourseId);
        return self::ok($course);
    }

    public function signs(Request $r) {
        $signs = StudentSignModel::courseSigns($r->studentId, $r->courseId);
        return self::ok($signs);
    }
}
